package com.nulgame.bukkit.plugin.responsebuilder;

import com.nulgame.bukkit.plugin.resource.Resource;

public class GenericResponseBuilder implements ResponseBuilder {
	protected String m_responseFormat;
	protected String m_playerName;
	protected String m_message;
	
	public GenericResponseBuilder(String responseFormat, String playerName, String message){
		m_responseFormat = responseFormat;
		m_playerName = playerName;
		m_message = message;
	}
	
	@Override
	public String toResponse() { 
		if(m_responseFormat == null || m_responseFormat.isEmpty()){
			return null;
		}
		String response =  m_responseFormat.replaceAll(Resource.PLAYER_NAME_VARIABLE, m_playerName);
		response = response.replaceAll(Resource.MESSAGE_VARIABLE, m_message);
		return response;
	}

}
